package cn.buk.tms.dto;

import cn.buk.tms.entity.misc.FlightInfo;

public class ReportTicketDetailDto {

	private String dport;

	private String dportName;

	private String aport;

	private String aportName;

	private String carrier;

	private String flight;

	private String subclass;

	private String ddate;

	private String dtime;

	private String atime;

	private String dterm;

	private String aterm;

	/**
	 * 只对改签票有含义
	 */
	private int flightType; //0-改签之前的航班（原）， 1 - 改签之后的航班（新）

	public static ReportTicketDetailDto createByFlightInfo(FlightInfo flt) {
		ReportTicketDetailDto dto = new ReportTicketDetailDto();

		dto.setDport(flt.getDepartureAirport());
		dto.setDportName(flt.getDepartureAirportName());

		dto.setAport(flt.getArrivalAirport());
		dto.setAportName(flt.getArrivalAirportName());

		dto.setFlight(flt.getFlightNo());
		dto.setSubclass(flt.getSubclass());

		dto.setDdate(flt.getDepartureDate());
		dto.setDtime(flt.getDepartureTime());

		dto.setFlightType(flt.getFlightType());

		return dto;
	}

	public String getDport() {
		return dport;
	}

	public void setDport(String dport) {
		this.dport = dport;
	}

	public String getAport() {
		return aport;
	}

	public void setAport(String aport) {
		this.aport = aport;
	}

	public String getCarrier() {
		return carrier;
	}

	public void setCarrier(String carrier) {
		this.carrier = carrier;
	}

	public String getFlight() {
		return flight;
	}

	public void setFlight(String flight) {
		this.flight = flight;
	}

	public String getSubclass() {
		return subclass;
	}

	public void setSubclass(String subclass) {
		this.subclass = subclass;
	}

	public String getDdate() {
		return ddate;
	}

	public void setDdate(String ddate) {
		this.ddate = ddate;
	}

	public String getDtime() {
		if (dtime != null && dtime.length() == 4) {
      return dtime.substring(0, 2) + ":" + dtime.substring(2);
    } else {
      return dtime;
    }
	}

	public void setDtime(String dtime) {
		this.dtime = dtime;
	}

	public String getAtime() {
		return atime;
	}

	public void setAtime(String atime) {
		this.atime = atime;
	}

	public void setDterm(String dterm) {
		this.dterm = dterm;
	}

	public String getDterm() {
		return dterm;
	}

	public void setAterm(String aterm) {
		this.aterm = aterm;
	}

	public String getAterm() {
		return aterm;
	}

	public String getDportName() {
		return dportName;
	}

	public void setDportName(String dportName) {
		this.dportName = dportName;
	}

	public String getAportName() {
		return aportName;
	}

	public void setAportName(String aportName) {
		this.aportName = aportName;
	}

	public int getFlightType() {
		return flightType;
	}

	public void setFlightType(int flightType) {
		this.flightType = flightType;
	}
}
